package cn.bgs.mapper;


import cn.bgs.pojo.File;
import cn.bgs.pojo.Maintenance;
import cn.bgs.pojo.ProjectType;
import cn.bgs.vo.CellIntermediate;
import cn.bgs.vo.MaintenanceListVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 维修记录表 Mapper 接口
 * </p>
 *
 * @author cf
 * @since 2022-06-07
 */
@Mapper
public interface MaintenanceMapper extends BaseMapper<Maintenance> {

    /**
     * 查询所有维修记录
     * @param userId
     * @return
     */
    List<MaintenanceListVo> getMaintenanceList(@Param("userId") Integer userId);

    /**
     * 查询级联维修类型和项目
     * @return
     */
    List<ProjectType> getMaintenceTree();

    /**
     * 添加中间表
     * @param cellIntermediate
     */
    void saveCellIntermediate(CellIntermediate cellIntermediate);

    /**
     * 添加维修记录表
     * @param maintenance
     */
    void saveMaintence(Maintenance maintenance);

    /**
     * 添加维修记录图片
     * @param maintenanceId
     * @param fileUrl
     * @return
     */
    int saveMaintencePhonto(@Param("maintenanceId") Integer maintenanceId,@Param("fileUrl") String fileUrl);

    /**
     * 撤销申请
     * @param maintenanceId
     * @return
     */
    int deleteMaintence(Integer maintenanceId);


    List<Maintenance> findAll(Integer communityId);

    Boolean into(@Param("theTitle") String theTitle,@Param("problemDescription") String problemDescription,@Param("phone") Integer phone,@Param("appointmentTime") Date appointmentTime);

    Boolean delete1(Integer maintenanceId);

    List<Maintenance> findById(Integer id);

    Boolean shenhe(@Param("id") Integer id,@Param("shen") String shen);

}
